const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '补贴类型', prop: 'subsidyTypeLabel' },
		{ label: '名称', prop: 'workflowName' },
		{ label: '创建人', prop: 'createUserName' },
		{ label: '创建时间', prop: 'createTime' },
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '审核配置名称',
			prop: 'workflowName',
			type: 'input',
			span: 12,
			labelPosition: 'top',
			rules: [{ required: true, message: '请输入审核配置名称' }],
		},
		{
			label: '补贴类型',
			prop: 'subsidyType',
			propName: 'subsidyTypeLabel',
			type: 'remoteSelect',
			code: 'SUBSIDY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			labelPosition: 'top',
			span: 12,
		},
		{
			label: '周 期',
			prop: 'cycle',
			type: 'radio',
			labelPosition: 'top',
			dicData: [
				{ label: '月', value: 1 },
				{ label: '季度', value: 2 },
				{ label: '半年', value: 3 },
				{ label: '年', value: 4 },
				// { label: '一次性', value: 5 },
			],
			span: 24,
		},
		{
			label: '流程配置',
			prop: 'config',
			type: 'input',
			span: 24,
			labelPosition: 'top',
		},
	],
}


export const api = {
	index: 'view_workflow_page',
	add: 'view_workflow_add',
	edit: 'view_workflow_edit',
	delete: 'view_workflow_del',
	detail: 'view_workflow_view',
}

export const baseConfig = {
	pageName: '审核配置管理',
	dictcodes: ['COMMON_FLAG', 'SUBSIDY_TYPE', 'EQUIP_STATUS'],
	rowKey: 'id',
	tipLabel: 'workflowName',
	addLabel: '新增',
	exportMqTopic: '/ning/export/',
	paramsObj: {
		code: 3003,
	},
	api,
	auth: api,
	menuBtn: [
		{
			icon: 'detail',
			label: '查看',
			type: 'primary',
			operate: 'detail',
			auth: api.detail,
			text: true,
			show: true,
		},
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: api.edit,
			text: true,
			show: true,
		},
		{
			icon: 'danger',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: api.delete,
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '80%',
	},
	searchConfig: {
		inline: true,
		showBtn: true,
		labelPosition: 'left',
		column: [
			{ label: '名称', prop: 'workflowName', type: 'input', span: 8 },
			{
				label: '补贴类型',
				prop: 'subsidyType',
				type: 'remoteSelect',
				code: 'SUBSIDY_TYPE',
				api: 'getDictItemList',
				filterKey: 'value',
				multiple: false,
				span: 8,
			},
		],
	},
	tableConfig,
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			return {
				...item,
				workflowConfiguration: item.workflowConfiguration ? JSON.parse(item.workflowConfiguration) : [],
			}
		})
		console.log(tableData, 'tableData')
		return Promise.resolve(Object.freeze(tableData))
	},
}
